package com.guodefu.demo.domain;

import com.baomidou.mybatisplus.annotation.FieldStrategy;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.guodefu.jackson.config.conversion.BigDecimalFormat;
import com.guodefu.sensitive.annotation.Sensitive;
import com.guodefu.sensitive.handler.NameSensitiveStrategy;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDateTime;
import java.util.Date;

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName("sys_dict")
public class DictionaryDO {

    @TableId(type = IdType.ASSIGN_ID)
    private Long id;
    private String type;
    private String code;
    @Sensitive(maskString = "***", type = NameSensitiveStrategy.class)
    private String name;
    private String ename;


    @TableField(exist = false)
    @BigDecimalFormat(scale = 3, roundingMode = RoundingMode.UP)
    @Builder.Default
    private BigDecimal money = new BigDecimal("111111.222222");

    @TableField(exist = false)
    @Builder.Default
    private Date birthDay = new Date();
    /**
     * '@JsonIgnore'注解让jackson忽略该属性
     */
//    @JsonIgnore
    private String description;

    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private LocalDateTime createTime;

    @TableField(insertStrategy = FieldStrategy.NEVER, updateStrategy = FieldStrategy.NEVER)
    private LocalDateTime updateTime;
}